﻿package org.nickro.effects 
{
	/**
	 * ...
	 * @author nickro
	 * 
	 * 【弹性效果】示例说明：
	 * var ball:MovieClip = new BALL();
	 * addChild(ball);
	 * var xVel:Number = 0;
	 * var yVel:Number = 0;
	 * addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);
	 * function onLoop(myEvent:Event):void {
	 * 		xVel = myElasticity(ball.x, mouseX, .15, .85, xVel);
	 * 		yVel = myElasticity(ball.y, mouseY, .15, .85, yVel);
	 * 		// 设置对象弹性运动
	 * 		ball.x += xVel;
	 * 		ball.y += yVel;
	 * 		// 设置对象朝向光标 
	 * 		ball.rotation = Math.atan2(mouseY-ball.y, mouseX-ball.x)*180/Math.PI;
	 * ｝
	 * // 函数myElasticity形成弹性运动 
	 * function myElasticity(orig:Number, dest:Number, paradd:Number, parmult:Number, elas:Number):Number {
	 * 		elas += paradd * (dest - orig);
	 * 		return elas*= parmult;
	 * }
	 * 
	 * 
	 */
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class MyElasticity 
	{		
		public function MyElasticity(orig:Number, dest:Number, paradd:Number, parmult:Number, elas:Number):Number
		{
			elas += paradd * (dest - orig);
	  		return elas*= parmult;
		}		
	}

}